<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>Monthly Production Plan | Merlion's ERP System</title>
    </ui:define>
    <ui:define name="content">
        <f:view beforePhase="#{plannedMonthlyDemand.initView}">
            <p:panel header="Monthly Production Plan">
                <p:tabView>
                    <p:tab title="Nuts">                    
                        <p:panel style="width: 900px; max-width: 900px; overflow: scroll; border-style: none;">
                            <h:form prependId="false">   
                                <p:dataTable var="data" value="" id="tableA" >  
                                    <p:columns value="#{plannedMonthlyDemand.simpleColumns}"  
                                                var="column" columnIndexVar="colIndex" >  
                                        <f:facet name="header">  
                                            #{column.header}  
                                        </f:facet>  

                                        <h:form>  
                                            <p:dataTable  var="row" value="#{plannedMonthlyDemand.dataListA}">  
                                                <p:column>
                                                    <f:facet name="header">  
                                                    </f:facet> 
                                                    <h:outputText value="#{row[column.property]}" />
                                                </p:column>                      
                                            </p:dataTable>  
                                        </h:form>  
                                    </p:columns>  
                                </p:dataTable>  
                            </h:form>      
                        </p:panel>
                    </p:tab>

                    <p:tab title="Fruits">
                        <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                            <h:form prependId="false">   
                                <p:dataTable var="data" value="" id="tableB" >  
                                    <p:columns value="#{plannedMonthlyDemand.simpleColumns}"  
                                                var="column" columnIndexVar="colIndex" >  
                                        <f:facet name="header">  
                                            #{column.header}  
                                        </f:facet>  

                                        <h:form>  
                                            <p:dataTable var="row" value="#{plannedMonthlyDemand.dataListB}">  
                                                <p:column>
                                                    <f:facet name="header">  
                                                    </f:facet> 
                                                    <h:outputText value="#{row[column.property]}" />
                                                </p:column>                      
                                            </p:dataTable>  
                                        </h:form>  
                                    </p:columns>  
                                </p:dataTable>  
                            </h:form>      
                        </p:panel>
                    </p:tab>

                    <p:tab title="Chocolate Nuts">
                        <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                            <h:form prependId="false">   
                                <p:dataTable var="data" value="" id="tableC" >  
                                    <p:columns value="#{plannedMonthlyDemand.simpleColumns}"  
                                                var="column" columnIndexVar="colIndex" >  
                                        <f:facet name="header">  
                                            #{column.header}  
                                        </f:facet>  

                                        <h:form>  
                                            <p:dataTable var="row" value="#{plannedMonthlyDemand.dataListC}">  
                                                <p:column>
                                                    <f:facet name="header">  
                                                    </f:facet> 
                                                    <h:outputText value="#{row[column.property]}" />
                                                </p:column>                      
                                            </p:dataTable>  
                                        </h:form>  
                                    </p:columns>  
                                </p:dataTable>  
                            </h:form>      
                        </p:panel>
                    </p:tab>

                    <p:tab title="Redcurrant Fruits">
                        <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                            <h:form prependId="false">   
                                <p:dataTable var="data" value="" id="tableD" >  
                                    <p:columns value="#{plannedMonthlyDemand.simpleColumns}"  
                                                var="column" columnIndexVar="colIndex" >  
                                        <f:facet name="header">  
                                            #{column.header}  
                                        </f:facet>  

                                        <h:form>  
                                            <p:dataTable var="row" value="#{plannedMonthlyDemand.dataListD}">  
                                                <p:column>
                                                    <f:facet name="header">  
                                                    </f:facet> 
                                                    <h:outputText value="#{row[column.property]}" />
                                                </p:column>                      
                                            </p:dataTable>  
                                        </h:form>  
                                    </p:columns>  
                                </p:dataTable>  
                            </h:form>      
                        </p:panel>
                    </p:tab>
                </p:tabView>

                <h:form>
                    <h:selectOneMenu value="#{plannedMonthlyDemand.month}" required="true" requiredMessage="Choose month">
                        <f:selectItem itemLabel="Select One" itemValue="" />  
                        <f:selectItems value="#{plannedMonthlyDemand.selectedMonths}" />  
                    </h:selectOneMenu>
                    <p:commandButton value="Generate Weekly Production Plan" actionListener="#{plannedMonthlyDemand.generateWeekly(event)}" ajax="true" />
                    <br/>
                </h:form>
            </p:panel>
        </f:view>
    </ui:define>
</ui:composition>
